package com.buanalintas.sandals.pos.entities;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlTransient;

@Entity
@Table(name = "pos_master_color")
//@NamedQueries({
//    @NamedQuery(name = "PosMasterColor.findAll", query = "SELECT t FROM PosMasterColor t"),
//    @NamedQuery(name = "PosMasterColor.findBySync", query = "SELECT t FROM PosMasterColor t WHERE t.sync = :sync"),
//    @NamedQuery(name = "PosMasterColor.findByColorId", query = "SELECT t FROM PosMasterColor t WHERE t.colorId = :colorId"),
//    @NamedQuery(name = "PosMasterColor.findByColorCode", query = "SELECT t FROM PosMasterColor t WHERE t.colorCode = :colorCode"),
//    @NamedQuery(name = "PosMasterColor.findByColorName", query = "SELECT t FROM PosMasterColor t WHERE t.colorName = :colorName")})
public class PosMasterColor implements Serializable {
    @OneToMany(mappedBy = "itemColorId")
    private Collection<PosMasterItem> posMasterItemCollection;

    private static final long serialVersionUID = 1L;
    @Column(name = "sync")
    private String sync;
    @Id
    @Basic(optional = false)
    @Column(name = "color_id")
    private Integer colorId;
    @Column(name = "color_code")
    private String colorCode;
    @Column(name = "color_name")
    private String colorName;

    public PosMasterColor() {
    }

    public PosMasterColor(Integer colorId) {
        this.colorId = colorId;
    }

    public String getSync() {
        return sync;
    }

    public void setSync(String sync) {
        this.sync = sync;
    }

    public Integer getColorId() {
        return colorId;
    }

    public void setColorId(Integer colorId) {
        this.colorId = colorId;
    }

    public String getColorCode() {
        return colorCode;
    }

    public void setColorCode(String colorCode) {
        this.colorCode = colorCode;
    }

    public String getColorName() {
        return colorName;
    }

    public void setColorName(String colorName) {
        this.colorName = colorName;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (colorId != null ? colorId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        if (!(object instanceof PosMasterColor)) {
            return false;
        }
        PosMasterColor other = (PosMasterColor) object;
        if ((this.colorId == null && other.colorId != null) || (this.colorId != null && !this.colorId.equals(other.colorId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        //   return "com.buanalintas.sandals.pos.entities.PosMasterColor[colorId=" + colorId + "]";
        return colorName;
    }

    @XmlTransient
    public Collection<PosMasterItem> getPosMasterItemCollection() {
        return posMasterItemCollection;
    }

    public void setPosMasterItemCollection(Collection<PosMasterItem> posMasterItemCollection) {
        this.posMasterItemCollection = posMasterItemCollection;
    }
}
